tools: init.d/Linux/xencommons: run script only when needed
authorOlaf Hering <olaf@aepfle.de>
Thu, 1 Dec 2011 18:27:42 +0000 (18:27 +0000)
committerOlaf Hering <olaf@aepfle.de>
Thu, 1 Dec 2011 18:27:42 +0000 (18:27 +0000)
Currently xencommons prints an error that /proc/xen/capabilities does
not exist when started on a non-xen kernel.

Update the xencommons script to run only when needed:
- do not run if /proc/xen does not exist
- check if /proc/xen/capabilities exists before doing the grep for dom0

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/hotplug/Linux/init.d/xencommons

index 26ab3032799c1103b488d2aeb86358bb036d9ca5..1378bef0faedd08afad2d2cd8e4a45ef075d981a 100644 (file)
@@ -29,15 +29,24 @@ test -f $xencommons_config/xencommons && . $xencommons_config/xencommons
 XENCONSOLED_PIDFILE=/var/run/xenconsoled.pid
 shopt -s extglob
 
+# not running in Xen dom0 or domU
+if ! test -d /proc/xen ; then
+       exit 0
+fi
+
+# mount xenfs in dom0 or domU with a pv_ops kernel
 if test "x$1" = xstart && \
-     test -d /proc/xen && \
    ! test -f /proc/xen/capabilities && \
    ! grep '^xenfs ' /proc/mounts >/dev/null;
 then
        mount -t xenfs xenfs /proc/xen
 fi
 
-if ! grep -q "control_d" /proc/xen/capabilities ; then
+# run this script only in dom0:
+# no capabilities file in xenlinux domU kernel
+# empty capabilities file in pv_ops domU kernel
+if test -f /proc/xen/capabilities && \
+   ! grep -q "control_d" /proc/xen/capabilities ; then
        exit 0
 fi